<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="__STATIC__/js/layer/css/layui.css"  media="all">
    <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body>
<input type="file" name="image" id="image">
<script src="__STATIC__/js/layer/layui/layui.js" type="text/javascript"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
    layui.use('upload', function(){
        var type="{:\\think\\Request::instance()->param('type')}";
        var fileType="{:\\think\\Request::instance()->param('fileType')}";
        var fontFileType = fileType.replace(/,/g,"|");
        layui.upload({
            unwrap:true,
            ext: fontFileType,
            url: '/uploadAll?type='+type+'&fileType='+fileType
            ,elem: '#image' //指定原始元素，默认直接查找class="layui-upload-file"
            ,method: 'post' //上传接口的http类型
            ,success: function(res){
                if(res.code==0) {
                    parent.$("#reviewFile{:\\think\\Request::instance()->param('d')}").val(res.data);
                    // parent.$("#reviewImg{:\\think\\Request::instance()->param('d')}").show();
                    //     parent.$("#reviewImg{:\\think\\Request::instance()->param('d')}").attr('src', res.msg);
                    parent.$("#uploadErr").hide();
                    parent.$("#uploadSuccess").html('选择文件：'+res.fileName);
                    parent.$("#uploadSuccess").show();
                    var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                    parent.layer.close(index);//关闭弹出的子页面窗口
                }else{
                    parent.$("#uploadSuccess").hide();
                    parent.$("#uploadErr").show();
                }
            }
        });
    });
</script>

</body>
</html>